package com.demo.hystrix.ribbon.client.controller;

import com.demo.hystrix.ribbon.client.config.RibbonAnnotationConfiguration;
import com.demo.hystrix.ribbon.client.sevice.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("hello")
@RibbonClients(value = {@RibbonClient(name = "hystrix-ribbon-server", configuration = RibbonAnnotationConfiguration.class)})
public class HelloController {

    @Autowired
    HelloService helloService;

    @GetMapping("hi")
    public String hi() {
        return helloService.hello();
    }
}
